<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="com.yaodian100.ec.coupon.entity.CouponItem"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="com.yaodian100.core.common.utils.DateUtil"%>
<%@page import="org.apache.commons.lang.time.DateUtils"%>
<%@page import="java.util.Date"%>
<%@page import="com.yaodian100.core.common.utils.ServerValue"%>

<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@taglib uri="http://www.yaodian100.com/jsp/yaodian100" prefix="yaodian100" %>
<%@taglib prefix="s" uri="/struts-tags"%>

<c-rt:set var="frontContentPath" value='<%=ServerValue.getFrontContextPath()%>'/>
<c-rt:set var="imgDomain" value='<%=ServerValue.getImgDomain()%>'></c-rt:set>
<c-rt:set var="now" value="<%=new java.util.Date()%>" />
<c-rt:if test="${orderByDate=='desc' or orderByDate == 'desc'}">
  <c-rt:set var="nextOrderByDate" value="asc"/>
</c-rt:if>
<c-rt:if test="${orderByDate=='asc' or orderByDate == 'asc'}">
  <c-rt:set var="nextOrderByDate" value="desc"/>
</c-rt:if>

<div class="s-location"><a href="${frontContentPath}/">首页</a> &gt; 会员讯息</div>

<div id="main">
  <div class="lcontainer">
       <a href="/act/allevent/eventlist.html"><img src="${imgDomain}/act/allevent/images/banner.jpg" alt="全场优惠活动" width="193" height="403" /></a>
  </div>
  <div class="rcontainer">
  <h1 class="newstitle">会员讯息</h1>
	<div class="pages-top">共${announcementSize}笔： ${pager.currentPage+1}/${pager.pageSize}
      <c-rt:choose>
        <c-rt:when test="${pager.currentPage==0}">
        	<span class="a-no">&lt; 上一页</span> |
        </c-rt:when>
        <c-rt:otherwise>
        	<a href="${frontContentPath}/announcement/listAllMemberMessage.do?orderByDate=${orderByDate}&pager.currentPage=${pager.currentPage-1}">&lt; 上一页</a> |
        </c-rt:otherwise>
      </c-rt:choose>
      <c-rt:choose>
        <c-rt:when test="${pager.currentPage == pager.pageSize-1}">
        	<span class="a-no">下一页 &gt;</span>
        </c-rt:when>
        <c-rt:otherwise>
        	<a href="${frontContentPath}/announcement/listAllMemberMessage.do?orderByDate=${orderByDate}&pager.currentPage=${pager.currentPage+1}">下一页 &gt;</a>
        </c-rt:otherwise>
      </c-rt:choose>
    </div>
    
    <div class="newslist-wrap">
      <table border="0" cellpadding="0" cellspacing="0" class="newslist-table">
        <tbody>
          <tr class="newslist-title">
              <th class="newslist-num">&nbsp;</th>
              <th class="newslist-ititle">标题</th>
              <th <c-rt:if test="${orderByDate=='asc' }">class="newslist-podated"</c-rt:if><c-rt:if test="${orderByDate=='desc' }">class="newslist-podate"</c-rt:if>>
                <a href="${frontContentPath}/announcement/listAllMemberMessage.do?orderByDate=${nextOrderByDate}">发布时间</a>
              </th>
          </tr>
          
          <c-rt:set var="count" value="${pager.currentPage*10}" />
          <c-rt:forEach items="${announcementList}" var="announcement">
            <c-rt:set var="count" value="${count+1}" />
            <tr>
              <td class="newslist-num">
                <fmt:formatNumber value="${count}" pattern="00"/>
              </td>
              <td>
                <c-rt:choose>
                  <c-rt:when test="${announcement.endDate > now}">
                    <c-rt:if test="${not empty announcement.targetURL}">
                      <c-rt:set var="announcementHref" value="${announcement.targetURL}" />
                    </c-rt:if>
                    <c-rt:if test="${empty announcement.targetURL}">
                      <c-rt:set var="announcementHref" value="${frontContentPath}/announcement/viewMemberMessage.do?annId=${announcement.id}" />
                    </c-rt:if>
                    <a href="${announcementHref}" target="_blank">
                      ${announcement.subject}
                    </a>
                  </c-rt:when>
                  <c-rt:otherwise>
                    ${announcement.subject}
                  </c-rt:otherwise>
                </c-rt:choose>
              </td>
              <td><fmt:formatDate value="${announcement.startDate}" pattern="yyyy-MM-dd"/></td>
            </tr>
          </c-rt:forEach>
        </tbody>
      </table>
    </div>
    
    <div class="pages-bottom">
	   <span>
	     <yaodian100:pager10 pagerObj="${pager}" link="${frontContentPath}/announcement/listAllMemberMessage.do?orderByDate=${orderByDate}"/>
       </span>
    </div>
    <div class="goback"><a href="/act/allevent/eventlist.html"> &gt;&gt; 全场优惠活动</a></div>
  </div>
</div>